package panel;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import model.ListItem;

/**
 * This panel holds the tabbed panes for navigation. All kind of tab operation is done in 
 * this class
 * @author Shahriar Haque
 *
 */
public class ContentPanel extends JPanel {


	private static final long serialVersionUID = 1L;
	
	private JTabbedPane tabbedPane;
	
	public ContentPanel(){
		
		Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
		setPreferredSize(new Dimension(d.width-20,(int)(d.height - 50)));
		
		tabbedPane = new JTabbedPane();
		tabbedPane.setPreferredSize(getPreferredSize());
		
		
		
		this.add(tabbedPane);
		
	}
	
	public void openInCurrentTab(ListItem i){
		//tabbedPane.setSelectedComponent(new TabularView(i.getDescription()));
		
		tabbedPane.addTab(i.getName(), new TabularView(i.getDescription()));
	}
	
	

}
